/*
 * ip_camera_viewer.h
 *
 *  Created on: Oct 27, 2010
 *      Author: Alexey Brodkin
 */

#ifndef IP_CAMERA_VIEWER_H_
#define IP_CAMERA_VIEWER_H_


#include "ui_QFriendlyCameraViewer.h"
#include "QIpCamera.h"
#include "QConfigParser.h"
#include <QMainWindow>
#include <QLabel>


#define MONITORS_NUMBER     4
#define DEFAULT_PERIOD_MONITOR      500 // msecs
#define DEFAULT_PERIOD_ZOOMED       200 // msecs


typedef enum {
    VIEW_MODE_MONITOR = 0,
    VIEW_MODE_ZOOM,
    VIEW_MODES_NUMBER
} view_mode_t;


namespace Ui {
    class MainWindow;
}


class IPCameraViewer : public QMainWindow {
    Q_OBJECT
public:
    IPCameraViewer(QWidget *parent = 0);
    ~IPCameraViewer();    
    
protected:
    bool eventFilter(QObject *object, QEvent *event);

private:
    void init_camera(int number, QLabel * widget);
    
        
    int monitor_zoomed_number;
    int intervals[VIEW_MODES_NUMBER];
    view_mode_t mode;
    QConfigParser * config_parser;
    QIpCamera * ip_camera[MONITORS_NUMBER];    
    QLabel * monitor_widget[MONITORS_NUMBER];
    QLabel * zoom_widget;
    Ui::MainWindow * ui;

private slots:
    void on_pb_info_toggled();
    void set_pixmap(int index, QPixmap pixmap);
};

#endif /* IP_CAMERA_VIEWER_H_ */
